BIN=myproc
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
CC=gcc
LINKFLAGS=-o
FLAGS=-c
RM=rm -f

$(BIN):$(OBJ)
	@$(CC) $(LINKFLAGS) $@ $^
	@echo "linking... $^ to $@"

%.o:%.c
	@$(CC) $(FLAGS) $<
	@echo "compiling... $< to $(OBJ)"

.PHONY:clean
clean:
	@$(RM) $(BIN) $(OBJ)
	@echo "removing... $(BIN) $(OBJ)"

.PHONY:test
test:
	@echo $(SRC)
	@echo $(SRC)

#BIN=myproc
#SRC=myproc.c
#CC=gcc
#FLAGS=-o
#RM=rm -f
#
#$(BIN):$(SRC)
#	@$(CC)  $(FLAGS) $@ $^
#	@echo "linking $^ to $@..."
#
#.PHONY:clean
#clean:
#	@$(RM) $(BIN)
#	@echo "removing $(BIN)..."
#
#.PHONY:test
#test:
#	@echo $(BIN)
#	@echo $(SRC)
#	@echo $(CC)
#	@echo $(FLAGS)
#	@echo $(RM)



#myproc:myproc.o
#	gcc myproc.o -o myproc
#myproc.o:myproc.s
#	gcc -c myproc.s -o myproc.o
#myproc.s:myproc.i
#	gcc -S myproc.i -o myproc.s
#myproc.i:myproc.c
#	gcc -E myproc.c -o myproc.i
#
#.PHONY:clear
#clear:
#	rm -rf *.i *.s *.o myproc 


#myproc:myproc.c
#	gcc myproc.c -o myproc
#
#.PHONY:clean 
#clean:
#	rm -rf myproc
#
